<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/page_init.jsp"%>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>Insert title here</title>
</head>
<body>

  <div class="main-right l">
    <div class="main-right-scroll">
      <div class="title-bt"><span class="pl10">添加管理用户</span><span class="pr10 tr">
        <button class="btn-28" onclick="javasript:back();">返回</button>
        </span>
	 </div>
      <div class="right-content">
        <div class="operate-nav">
            <div class="operate-contant">
              <table width="100%" border="0" cellspacing="0" cellpadding="0" >
                <tr>
                  <td width="10%" class="mandatory">登录ID:</td>
                  <td width="40%"><input id="loginId" name="loginId" type="text" class="width-180" /></td>
                </tr>
                <tr>
                  <td width="10%" class="mandatory">用户名:</td>
                  <td width="40%"><input id="name" name="name" type="text" class="width-180" /></td>
                </tr>
                <tr>
                  <td width="10%" class="mandatory">读写属性:</td>
                  <td width="40%">
                  	  <select id="editable" class="width-180">
                  	  	<option value="0">只读</option>
                  	  	<option value="1">读写</option>
                  	  </select>
                  </td>
                </tr>
                <tr>
                  <td width="10%" class="mandatory">登录密码:</td>
                  <td width="40%"><font class="hint fb">默认为6个1，添加完请尽快通知维护人员修改登录密码</font></td>
                </tr>
              </table>
            </div>
        	<div class="mt10 mb10 tr"><button class="btn-28" id="add_user_btn">保存</button></div>
          </div>
      </div>
    </div>
   </div>
	<script type="text/javascript">
		$(function() {
			$("#add_user_btn").on("click", function() {
				var loginId = $("#loginId").val();
				var name = $("#name").val();
				var editable = $("#editable").val();
				if(loginId==''){
					apexLayer.Warn("请先输入登录ID");
					return;
				}
				if(name==''){
					apexLayer.Warn("请先输入用户名");
					return;
				}
				
				Ajax({
					url: contextPath+"/console/user/add",
					isMask : true,
					data: {
						"loginId": loginId,
						"editable": editable,
						"name": name
					},
					success: function (data) {
						if (data.success) {
							apexLayer.Msg("添加成功",1000,function(){
								self.window.location = contextPath+"/console/user/list";
							});
						} else {
							apexLayer.Error(data.note);
						}
					}
				});
			});
		});
		
		function back(){
			self.window.location = contextPath+"/console/user/list";
		}
	</script>
</body>
</html>